<?php
    require_once('__common.php');
    $year = isset($_GET['year']) ? $_GET['year'] : date('Y');
    $month = isset($_GET['month']) ? $_GET['month'] : date('m');
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    
    $offset = ($page-1) * 6;
    list($count) =  mysql_fetch_row(mysql_query("SELECT count(1) FROM course WHERE year = $year and month = $month AND `check` = 1"));
    $res = mysql_query("SELECT * FROM course WHERE year = $year and month = $month AND `check` = 1  LIMIT $offset, 6");

    $data = array();
    $t= array();
    $b = array();
    $data = array();
    $data2 = array();
$i = 0;

    while($temp = mysql_fetch_assoc($res)) {
        $week = array();
        if($temp['w_mon']) {
            $week[] = '월';
        }
        if($temp['w_tue']) {
            $week[] = '화';
        }
        if($temp['w_wed']) {
            $week[] = '수';
        }
        if($temp['w_thu']) {
            $week[] = '목';
        }
        if($temp['w_fri']) {
            $week[] = '금';
        }
        if($temp['w_sat']) {
            $week[] = '토';
        }
        $temp['time'] = implode(',', $week).' '.encodeTime($temp['starttime']);
        $temp['price'] = number_format($temp['price']);
        $temp2 = array();
        $temp2['c'] = $temp;
        $temp2['t'] = getDb('g4_member', $temp['teacher'], 'mb_no');
        $temp2['b'] = getDb('book', $temp['bookcode'], 'no');
        if(!($i%2)) {
                $data [] = $temp2;
        } else {
            $data2[] = $temp2;
        }
        $i++;
    }

        $years = array(); 
        $thisYear = date('Y');
        for($i = 2008; $i <= $thisYear; $i++) {
                $years[$i]= array('y' => "{$i}년");
                if($i == $_GET['year']) {
                    $years[$i]['s'] = 'selected="selected"';
                }
        }

        $monthSelected = array($month=>'selected="selected"');
    $pager = getPager2($count, 6);
    $tpl->print_('basic');
